﻿﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Xml.Serialization;
using Fcdbas.Core;
using Fcdbas.Core.Configuration;
using Fcdbas.Core.DataAccess;


namespace Fcdbas.Biz
{
    /// <summary></summary>
    [Serializable]
    [DataObject]
    [Description("")]
    [BindTable("fnd_binary_object", Description = "", ConnName = "", DbType = DatabaseType.MySql)]
    public class fnd_binary_object : Entity<fnd_binary_object>,Ifnd_binary_object
    {
        #region 属性
 
        private Int32? _blob_id;

        /// <summary>FLAGS=KMI-L^DATATYPE=NUMBER^PROMPT=Blob Id^</summary>
        [DisplayName("ID")]
        [Description("FLAGS=KMI-L^DATATYPE=NUMBER^PROMPT=Blob Id^")]
        [DataObjectField(false, false, false, 10)]
        [BindColumn(1, "blob_id",  null, "int(11)", 10, 0, false)]

        public virtual Int32? blob_id

        {
            get { return _blob_id; }
            set { if (OnPropertyChanging(__.blob_id, value)) { _blob_id = value; OnPropertyChanged(__.blob_id); } }
        }

 
        private Int32? _seq_no;

        /// <summary>FLAGS=KMI--^DATATYPE=NUMBER^PROMPT=Seq No^</summary>
        [DisplayName("no")]
        [Description("FLAGS=KMI--^DATATYPE=NUMBER^PROMPT=Seq No^")]
        [DataObjectField(false, false, false, 10)]
        [BindColumn(2, "seq_no",  null, "int(11)", 10, 0, false)]

        public virtual Int32? seq_no

        {
            get { return _seq_no; }
            set { if (OnPropertyChanging(__.seq_no, value)) { _seq_no = value; OnPropertyChanged(__.seq_no); } }
        }

 
        private String _display_text;

        /// <summary>FLAGS=A-IUL^DATATYPE=STRING(2000)^PROMPT=Display Text^</summary>
        [DisplayName("Text")]
        [Description("FLAGS=A-IUL^DATATYPE=STRING(2000)^PROMPT=Display Text^")]
        [DataObjectField(false, false, true, 2000)]
        [BindColumn(3, "display_text",  null, "varchar(2000)", 0, 0, false)]

        public virtual String display_text

        {
            get { return _display_text; }
            set { if (OnPropertyChanging(__.display_text, value)) { _display_text = value; OnPropertyChanged(__.display_text); } }
        }

 
        private String _file_name;

        /// <summary>FLAGS=A-IUL^DATATYPE=STRING(200)^PROMPT=File Name^</summary>
        [DisplayName("Name")]
        [Description("FLAGS=A-IUL^DATATYPE=STRING(200)^PROMPT=File Name^")]
        [DataObjectField(false, false, true, 200)]
        [BindColumn(4, "file_name",  null, "varchar(200)", 0, 0, false)]

        public virtual String file_name

        {
            get { return _file_name; }
            set { if (OnPropertyChanging(__.file_name, value)) { _file_name = value; OnPropertyChanged(__.file_name); } }
        }

 
        private String _file_path;

        /// <summary>FLAGS=A-IU-^DATATYPE=STRING(200)^PROMPT=File Path^</summary>
        [DisplayName("Path")]
        [Description("FLAGS=A-IU-^DATATYPE=STRING(200)^PROMPT=File Path^")]
        [DataObjectField(false, false, true, 200)]
        [BindColumn(5, "file_path",  null, "varchar(200)", 0, 0, false)]

        public virtual String file_path

        {
            get { return _file_path; }
            set { if (OnPropertyChanging(__.file_path, value)) { _file_path = value; OnPropertyChanged(__.file_path); } }
        }

 
        private String _external_storage;

        /// <summary>FLAGS=A-IUL^DATATYPE=STRING(5)^PROMPT=External Storage^</summary>
        [DisplayName("Storage")]
        [Description("FLAGS=A-IUL^DATATYPE=STRING(5)^PROMPT=External Storage^")]
        [DataObjectField(false, false, true, 5)]
        [BindColumn(6, "external_storage",  null, "varchar(5)", 0, 0, false)]

        public virtual String external_storage

        {
            get { return _external_storage; }
            set { if (OnPropertyChanging(__.external_storage, value)) { _external_storage = value; OnPropertyChanged(__.external_storage); } }
        }

 
        private Int32? _length;

        /// <summary>FLAGS=A-IUL^DATATYPE=NUMBER^PROMPT=Length^</summary>
        [DisplayName("Length")]
        [Description("FLAGS=A-IUL^DATATYPE=NUMBER^PROMPT=Length^")]
        [DataObjectField(false, false, true, 10)]
        [BindColumn(7, "length",  null, "int(11)", 10, 0, false)]

        public virtual Int32? length

        {
            get { return _length; }
            set { if (OnPropertyChanging(__.length, value)) { _length = value; OnPropertyChanged(__.length); } }
        }

 
        private String _binary_object_type;

        /// <summary>FLAGS=A-IU-^DATATYPE=STRING(50)^PROMPT=Binary Object Type^</summary>
        [DisplayName("Type")]
        [Description("FLAGS=A-IU-^DATATYPE=STRING(50)^PROMPT=Binary Object Type^")]
        [DataObjectField(false, false, true, 50)]
        [BindColumn(8, "binary_object_type",  null, "varchar(50)", 0, 0, false)]

        public virtual String binary_object_type

        {
            get { return _binary_object_type; }
            set { if (OnPropertyChanging(__.binary_object_type, value)) { _binary_object_type = value; OnPropertyChanged(__.binary_object_type); } }
        }

 
        private Byte[] _data;

        /// <summary>FLAGS=A-IU-^DATATYPE=STRING(2000)^PROMPT=Data^</summary>
        [DisplayName("Data")]
        [Description("FLAGS=A-IU-^DATATYPE=STRING(2000)^PROMPT=Data^")]
        [DataObjectField(false, false, true, 65535)]
        [BindColumn(9, "data",  null, "blob", 0, 0, false)]

        public virtual Byte[] data

        {
            get { return _data; }
            set { if (OnPropertyChanging(__.data, value)) { _data = value; OnPropertyChanged(__.data); } }
        }

 
        private String _objid;

        /// <summary></summary>
        [DisplayName("Objid")]
        [Description("")]
        [DataObjectField(false, false, false, 50)]
        [BindColumn(10, "objid",  null, "varchar(50)", 0, 0, false)]

        public virtual String objid

        {
            get { return _objid; }
            set { if (OnPropertyChanging(__.objid, value)) { _objid = value; OnPropertyChanged(__.objid); } }
        }

 
        private String _objversion;

        /// <summary></summary>
        [DisplayName("Objversion")]
        [Description("")]
        [DataObjectField(false, false, true, 24)]
        [BindColumn(11, "objversion",  null, "varchar(24)", 0, 0, false)]

        public virtual String objversion

        {
            get { return _objversion; }
            set { if (OnPropertyChanging(__.objversion, value)) { _objversion = value; OnPropertyChanged(__.objversion); } }
        }
        #endregion

        #region 获取/设置 字段值
        /// <summary>
        /// 获取/设置 字段值。
        /// 一个索引，基类使用反射实现。
        /// 派生实体类可重写该索引，以避免反射带来的性能损耗
        /// </summary>
        /// <param name="name">字段名</param>
        /// <returns></returns>
        public override Object this[String name]
        {
            get
            {
                switch (name)
                {
                    case __.blob_id : return blob_id;
                    case __.seq_no : return seq_no;
                    case __.display_text : return display_text;
                    case __.file_name : return file_name;
                    case __.file_path : return file_path;
                    case __.external_storage : return external_storage;
                    case __.length : return length;
                    case __.binary_object_type : return binary_object_type;
                    case __.data : return data;
                    case __.objid : return objid;
                    case __.objversion : return objversion;
                    default: return base[name];
                }
            }
            set
            {
                switch (name)
                {
                    case __.blob_id : 
                        if(value != null)
                            blob_id = Convert.ToInt32(value);
                        else
                            blob_id = null;
                    break;
                    case __.seq_no : 
                        if(value != null)
                            seq_no = Convert.ToInt32(value);
                        else
                            seq_no = null;
                    break;
                    case __.display_text : 
                        if(value != null)
                            display_text = Convert.ToString(value);
                        else
                            display_text = null;
                    break;
                    case __.file_name : 
                        if(value != null)
                            file_name = Convert.ToString(value);
                        else
                            file_name = null;
                    break;
                    case __.file_path : 
                        if(value != null)
                            file_path = Convert.ToString(value);
                        else
                            file_path = null;
                    break;
                    case __.external_storage : 
                        if(value != null)
                            external_storage = Convert.ToString(value);
                        else
                            external_storage = null;
                    break;
                    case __.length : 
                        if(value != null)
                            length = Convert.ToInt32(value);
                        else
                            length = null;
                    break;
                    case __.binary_object_type : 
                        if(value != null)
                            binary_object_type = Convert.ToString(value);
                        else
                            binary_object_type = null;
                    break;
                    case __.data : _data = (Byte[])value; break;
                    case __.objid : 
                        if(value != null)
                            objid = Convert.ToString(value);
                        else
                            objid = null;
                    break;
                    case __.objversion : 
                        if(value != null)
                            objversion = Convert.ToString(value);
                        else
                            objversion = null;
                    break;
                    default: base[name] = value; break;
                }
            }
        }
        #endregion

        #region 字段名
        /// <summary>取得字段信息的快捷方式</summary>
        public class _
        {
            ///<summary>FLAGS=KMI-L^DATATYPE=NUMBER^PROMPT=Blob Id^</summary>
            public static readonly Field blob_id = FindByName(__.blob_id);

            ///<summary>FLAGS=KMI--^DATATYPE=NUMBER^PROMPT=Seq No^</summary>
            public static readonly Field seq_no = FindByName(__.seq_no);

            ///<summary>FLAGS=A-IUL^DATATYPE=STRING(2000)^PROMPT=Display Text^</summary>
            public static readonly Field display_text = FindByName(__.display_text);

            ///<summary>FLAGS=A-IUL^DATATYPE=STRING(200)^PROMPT=File Name^</summary>
            public static readonly Field file_name = FindByName(__.file_name);

            ///<summary>FLAGS=A-IU-^DATATYPE=STRING(200)^PROMPT=File Path^</summary>
            public static readonly Field file_path = FindByName(__.file_path);

            ///<summary>FLAGS=A-IUL^DATATYPE=STRING(5)^PROMPT=External Storage^</summary>
            public static readonly Field external_storage = FindByName(__.external_storage);

            ///<summary>FLAGS=A-IUL^DATATYPE=NUMBER^PROMPT=Length^</summary>
            public static readonly Field length = FindByName(__.length);

            ///<summary>FLAGS=A-IU-^DATATYPE=STRING(50)^PROMPT=Binary Object Type^</summary>
            public static readonly Field binary_object_type = FindByName(__.binary_object_type);

            ///<summary>FLAGS=A-IU-^DATATYPE=STRING(2000)^PROMPT=Data^</summary>
            public static readonly Field data = FindByName(__.data);

            ///<summary></summary>
            public static readonly Field objid = FindByName(__.objid);

            ///<summary></summary>
            public static readonly Field objversion = FindByName(__.objversion);

            static Field FindByName(String name) { return Meta.Table.FindByName(name); }
        }

        /// <summary>取得字段名称的快捷方式</summary>
        class __
        {
            ///<summary>FLAGS=KMI-L^DATATYPE=NUMBER^PROMPT=Blob Id^</summary>
            public const String blob_id = "blob_id";

            ///<summary>FLAGS=KMI--^DATATYPE=NUMBER^PROMPT=Seq No^</summary>
            public const String seq_no = "seq_no";

            ///<summary>FLAGS=A-IUL^DATATYPE=STRING(2000)^PROMPT=Display Text^</summary>
            public const String display_text = "display_text";

            ///<summary>FLAGS=A-IUL^DATATYPE=STRING(200)^PROMPT=File Name^</summary>
            public const String file_name = "file_name";

            ///<summary>FLAGS=A-IU-^DATATYPE=STRING(200)^PROMPT=File Path^</summary>
            public const String file_path = "file_path";

            ///<summary>FLAGS=A-IUL^DATATYPE=STRING(5)^PROMPT=External Storage^</summary>
            public const String external_storage = "external_storage";

            ///<summary>FLAGS=A-IUL^DATATYPE=NUMBER^PROMPT=Length^</summary>
            public const String length = "length";

            ///<summary>FLAGS=A-IU-^DATATYPE=STRING(50)^PROMPT=Binary Object Type^</summary>
            public const String binary_object_type = "binary_object_type";

            ///<summary>FLAGS=A-IU-^DATATYPE=STRING(2000)^PROMPT=Data^</summary>
            public const String data = "data";

            ///<summary></summary>
            public const String objid = "objid";

            ///<summary></summary>
            public const String objversion = "objversion";

        }
        #endregion
    }

    /// <summary>接口</summary>
    public partial interface Ifnd_binary_object
    {
       #region 属性
        /// <summary>FLAGS=KMI-L^DATATYPE=NUMBER^PROMPT=Blob Id^</summary>

        Int32? blob_id { get; set; }


        /// <summary>FLAGS=KMI--^DATATYPE=NUMBER^PROMPT=Seq No^</summary>

        Int32? seq_no { get; set; }


        /// <summary>FLAGS=A-IUL^DATATYPE=STRING(2000)^PROMPT=Display Text^</summary>

        String display_text { get; set; }


        /// <summary>FLAGS=A-IUL^DATATYPE=STRING(200)^PROMPT=File Name^</summary>

        String file_name { get; set; }


        /// <summary>FLAGS=A-IU-^DATATYPE=STRING(200)^PROMPT=File Path^</summary>

        String file_path { get; set; }


        /// <summary>FLAGS=A-IUL^DATATYPE=STRING(5)^PROMPT=External Storage^</summary>

        String external_storage { get; set; }


        /// <summary>FLAGS=A-IUL^DATATYPE=NUMBER^PROMPT=Length^</summary>

        Int32? length { get; set; }


        /// <summary>FLAGS=A-IU-^DATATYPE=STRING(50)^PROMPT=Binary Object Type^</summary>

        String binary_object_type { get; set; }


        /// <summary>FLAGS=A-IU-^DATATYPE=STRING(2000)^PROMPT=Data^</summary>

        Byte[] data { get; set; }


        /// <summary></summary>

        String objid { get; set; }


        /// <summary></summary>

        String objversion { get; set; }

        #endregion

        #region 获取/设置 字段值
        /// <summary>获取/设置 字段值。</summary>
        /// <param name="name">字段名</param>
        /// <returns></returns>
        Object this[String name] { get; set; }
        #endregion
    }
}